from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np

#定义图像和三维格式坐标轴
fig = plt.figure()  #定义新的三维坐标轴
ax1 = plt.axes(projection='3d')

xd = [[0,0,0,0,0,0,0,0,0],
[0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125],
[0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25,0.25],
[0.375,0.375,0.375,0.375,0.375,0.375,0.375,0.375,0.375],
[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],
[0.625,0.625,0.625,0.625,0.625,0.625,0.625,0.625,0.625],
[0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75],
[0.875,0.875,0.875,0.875,0.875,0.875,0.875,0.875,0.875],
[1,1,1,1,1,1,1,1,1]]
yd = [[0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1],
[0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1],
[0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1],
[0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1],
[0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1],
[0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1],
[0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1],
[0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1],
[0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1]]
zd = [[1,1.13278,1.2807,1.44235,1.61515,1.79517,1.97712,2.15447,2.31978],
[1.13315,1.38404,1.61079,1.82335,2.0241,2.21133,2.38031,2.52339,2.62865],
[1.28403,1.62213,1.91673,2.17787,2.40968,2.61166,2.77952,2.90558,2.97865],
[1.45499,1.86147,2.21268,2.51833,2.78325,3.00746,3.18669,3.31294,3.37526],
[1.64872,2.10817,2.50494,2.85034,3.15014,3.40448,3.60844,3.75274,3.82467],
[1.86825,2.36327,2.79278,3.17222,3.50878,3.80229,4.04638,4.22919,4.33391],
[2.117,2.62239,3.06746,3.47385,3.8496,4.1933,4.49632,4.74327,4.91097],
[2.39888,2.87216,3.30917,3.73458,4.15351,4.56131,4.9465,5.29076,5.56486],
[2.71828,3.07922,3.48129,3.92071,4.39042,4.87977,5.37436,5.85645,6.30581]]
ax1.scatter3D(xd,yd,zd)

ax1.set_xlabel('X', color='b')
ax1.set_ylabel('Y', color='g')
ax1.set_zlabel('Z', color='r')
plt.draw()
plt.savefig('8.png')
plt.show()
